﻿using System;
using System.Collections.Generic;
using System.Data;
using NBearLite;
using NBear.Mapping;
using Xin478.CSWork.Common;

namespace Xin478.CSWork.DomainModel
{
    public class GroupModel
    {
        public static IList<GroupInfo> GetEmployGroups(Database db,int employId)
        {
            return db.Select(MyWork.Employees_Group).Join(MyWork.Groups, MyWork.Groups.Id == MyWork.Employees_Group.GroupId).Where(MyWork.Employees_Group.EmployeeId == employId).ToList<GroupInfo>();
        }

        public static IList<GroupInfo> GroupList(Database db)
        {
            return db.Select(MyWork.Groups).ToList<GroupInfo>();
        }

    }
}